home *** CD-ROM | disk | FTP | other *** search
- import java.awt.image.MemoryImageSource;
-
- public class SmashTransition extends BannerTransition {
- static final float FOLDS = 8.0F;
- int[] fillPixels = null;
- int dropAmount;
- int location;
-
- public SmashTransition() {
- super.numOfFrames = 8;
- }
-
- public void finishInit() {
- this.fillPixels = new int[super.imageWidth];
-
- for(int f = 0; f < super.imageWidth; ++f) {
- this.fillPixels[f] = -1;
- }
-
- this.dropAmount = super.imageHeight / super.numOfFrames * super.imageWidth;
- this.location = super.pixelsPerImage - super.imageHeight / super.numOfFrames / 2 * super.imageWidth;
-
- for(int f = super.numOfFrames - 1; f >= 0; --f) {
- try {
- Thread.sleep(100L);
- } catch (InterruptedException var6) {
- }
-
- this.Smash(f + 1);
-
- try {
- Thread.sleep(150L);
- } catch (InterruptedException var5) {
- }
-
- super.frames[f] = super.owner.createImage(new MemoryImageSource(super.imageWidth, super.imageHeight, super.workPixels, 0, super.imageWidth));
- super.owner.prepareImage(super.frames[f], super.owner);
- this.location -= this.dropAmount;
- }
-
- super.workPixels = null;
- }
-
- void Smash(int max_fold) {
- System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, super.pixelsPerImage - this.location, super.workPixels, 0, this.location);
- int height = super.imageHeight - this.location / super.imageWidth;
- float foldOffsetAdder = (float)max_fold * 8.0F / (float)height;
- float foldOffset = 0.0F;
- int foldWidth = super.imageWidth - max_fold;
- float srcYAdder = (float)super.imageHeight / (float)height;
- float srcYOffset = (float)super.imageHeight - srcYAdder / 2.0F;
-
- for(int p = super.pixelsPerImage - super.imageWidth; p >= this.location; p -= super.imageWidth) {
- System.arraycopy(this.fillPixels, 0, super.workPixels, p, super.imageWidth);
- System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, (int)srcYOffset * super.imageWidth, super.workPixels, p + (int)foldOffset, foldWidth);
- srcYOffset -= srcYAdder;
- foldOffset += foldOffsetAdder;
- if ((double)foldOffset < (double)0.0F || foldOffset >= (float)max_fold) {
- foldOffsetAdder *= -1.0F;
- }
- }
-
- }
- }
-